home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / utils / bibclean / unixlib.h < prev    next >
C/C++ Source or Header  |  1992-11-19  |  30KB  |  823 lines

  1. /* -*-C-*- unixlib.h */
  2. /*-->unixlib*/
  3. /**********************************************************************/
  4. /******************************* unixlib ******************************/
  5. /**********************************************************************/
  6.  
  7. /* $Id: unixlib.h,v 1.15 1992/10/08 01:42:01 beebe Exp beebe $
  8.  * $Log: unixlib.h,v $
  9.  * Revision 1.15  1992/10/08  01:42:01  beebe
  10.  * Update for C++.
  11.  *
  12.  * Revision 1.14  1992/09/26  13:07:54  beebe
  13.  * Suppress declaration of delete() if running under C++ compiler, since
  14.  * it is a reserved word in that language.
  15.  *
  16.  * Revision 1.13  1992/07/10  18:01:56  beebe
  17.  * Add Convex and HPPA support.
  18.  * Add function prototypes for functions missing in PC DOS.
  19.  *
  20.  * Revision 1.12  1992/03/23  15:58:21  beebe
  21.  * Add function prototype for fileno for __LCC__ (ULTRIX with lcc).
  22.  *
  23.  * Revision 1.11  1992/03/16  19:48:20  beebe
  24.  * Add support for NeXT.
  25.  *
  26.  * Revision 1.10  1992/03/12  03:03:05  beebe
  27.  * *** empty log message ***
  28.  *
  29.  * Revision 1.10  1992/03/12  03:03:05  beebe
  30.  * *** empty log message ***
  31.  *
  32.  * Revision 1.9  1992/03/06  19:38:15  beebe
  33.  * *** empty log message ***
  34.  *
  35.  * Revision 1.8  1992/03/06  16:43:07  beebe
  36.  * *** empty log message ***
  37.  *
  38.  * Revision 1.7  1992/03/06  14:58:06  beebe
  39.  * Complete two-month long development of version 3.0.114.  See
  40.  * 00revhst.txt for details.
  41.  *
  42.  * Revision 1.6  1992/03/01  01:28:38  beebe
  43.  * *** empty log message ***
  44.  *
  45.  * Revision 1.5  1992/02/29  19:42:20  beebe
  46.  * Update for version 3.0.114 [29-Feb-1992] following two-month
  47.  * major overhaul and compilation testing on numerous machines.
  48.  *
  49.  * Revision 1.4  1992/01/22  02:37:14  beebe
  50.  * Initial revision.
  51.  *
  52.  * Revision 1.3  1992/01/22  02:04:26  beebe
  53.  * Add Revision Control System keyword comments.
  54.  *
  55.  * Revision 1.3  1992/01/22  02:04:26  beebe
  56.  * Add Revision Control System keyword comments.
  57.  *
  58.  */
  59.  
  60. /***********************************************************************
  61.  
  62. This file provides function prototypes for UNIX library functions that
  63. are usually not declared in <stdio.h> or other commonly-used include
  64. files.  Several UNIX systems do not yet have Standard C conformant
  65. compilers and libraries, but GNU gcc offers at least the compiler part
  66. (no GNU C library is yet available on UNIX; the host C library is used
  67. instead), and it can be asked to check argument passing and identify
  68. functions lacking prototype declarations.
  69.  
  70. This file requires definitions of fpos_t and size_t; both are provided
  71. by "os.h" (included automatically if needed).
  72.  
  73. POSIX-compliant UNIX implementations have a catch-all unistd.h file
  74. that declares run-time library functions.  When it is available and in
  75. addition, has full function prototypes, we use it, and then patch up
  76. its deficiencies.  Whenever unistd.h is included, the major portion of
  77. this file is omitted by defining UNIXLIB_H_DEFINED_.  Regrettably,
  78. many systems have been found to have deficient unistd.h files.
  79.  
  80. To facilitate identifying functions for which prototypes are missing
  81. in UNIX system header files, this file should be accompanied by
  82. funtst.c and funtst.sh.  The former is a C (and C++) file that can be
  83. compiled to determine problems.  The latter is a shell script that
  84. will make funtst.o and funtst.i, and then apply search the .i file for
  85. undeclared functions that should have prototypes in this file.
  86.  
  87. ***********************************************************************/
  88.  
  89. #ifndef UNIXLIB_H_DEFINED_
  90.  
  91. #ifndef OS_H_DEFINED_
  92. #include "os.h"
  93. #endif /* OS_H_DEFINED_ */
  94.  
  95. #include "xtypes.h"
  96.  
  97. /*====================================================================*/
  98.  
  99. #if (_AIX && (_AIX370 || ps2))
  100. /* IBM 3090 and PS/2 have identical include files */
  101. #include <unistd.h>
  102. #if !__cplusplus
  103. int        _filbuf ARGS((FILE *fp_));
  104. int        _flsbuf ARGS((unsigned char c_, FILE *fp_));
  105. int        access ARGS((const char *file_spec_, int mode_));
  106. int        close ARGS((int file_desc_));
  107. int        creat ARGS((const char *file_spec_, unsigned int mode_, ...));
  108. int        delete ARGS((const char *file_spec_));
  109. int        dup ARGS((int file_desc_));
  110. int        dup2 ARGS((int fd_1_, int fd_2_));
  111. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  112. int        fgetpos ARGS((FILE *file_ptr_, fpos_t *position_));
  113. int        fsetpos ARGS((FILE *file_ptr_, const fpos_t *position_));
  114. char        *getcwd ARGS((char *name_, int size_));
  115. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  116. int        getw ARGS((FILE *file_ptr_));
  117. int        ioctl ARGS((int file_desc_, int request_, ...));
  118. int        isapipe ARGS((int file_desc_));
  119. int        isatty ARGS((int file_desc_));
  120. int        lseek ARGS((int file_desc_, int offset_, int direction_));
  121. int        open ARGS((const char *file_spec_, int flags_, ...));
  122. int        putw ARGS((int integer_, FILE *file_ptr_));
  123. int        read ARGS((int file_desc_, void *buffer_, size_t nbytes_));
  124. unsigned int    sleep ARGS((unsigned int seconds_));
  125. int        system ARGS((const char *command_));
  126. int        tell ARGS((int file_desc_));
  127.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  128. char        *ttyname ARGS((int file_desc_));
  129. int        unlink ARGS((const char *path_));
  130. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  131. int        utime ARGS((const char *path_, time_t times_[2]));
  132. int        write ARGS((int file_desc_, const void *buffer_,
  133.             size_t nbytes_));
  134. #endif /* __cplusplus */
  135. #define UNIXLIB_H_DEFINED_
  136. #endif /* (_AIX && (_AIX370 || ps2)) */
  137.  
  138. /*====================================================================*/
  139.  
  140. #if (_AIX && _IBMR2)
  141.                     /* IBM RS/6000 AIX 3.1 and 3.2 */
  142. #include <unistd.h>
  143.  
  144. /* creat() 2nd arg is mode_t, not unsigned int, and no 3rd or more args */
  145. int        creat ARGS((const char *file_spec_, mode_t mode_));
  146.  
  147. #if !__cplusplus
  148.         /* this function conflicts with C++ reserved word */
  149. int        delete ARGS((const char *file_spec_));
  150. #endif /* !__cplusplus */
  151.  
  152. int        getw ARGS((FILE *file_ptr_));
  153. int        ioctl ARGS((int file_desc_, int request_, ...));
  154. int        isapipe ARGS((int file_desc_));
  155. int        open ARGS((const char *file_spec_, int flags_, ...));
  156. int        putw ARGS((int integer_, FILE *file_ptr_));
  157. int        system ARGS((const char *command_));
  158. int        tell ARGS((int file_desc_));
  159.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  160. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  161. int        utime ARGS((const char *path_, time_t times_[2]));
  162. #define UNIXLIB_H_DEFINED_
  163. #endif /* (_AIX && _IBMR2) */
  164.  
  165. /*====================================================================*/
  166.  
  167. #if __convex__
  168. #include <unistd.h>
  169. #define UNIXLIB_H_DEFINED_
  170. #endif /* __convex__ */
  171.  
  172. /*====================================================================*/
  173.  
  174. #if __hppa
  175.             /* HP-UX A.08.00 D 9000/850 */
  176. #include <unistd.h>
  177. #include <sys/types.h>            /* for mode_t definition */
  178. #if !__cplusplus
  179. int        _filbuf ARGS((FILE *fp_));
  180. int        _flsbuf ARGS((unsigned char c_, FILE *fp_));
  181.  
  182. /* creat() 2nd arg is mode_t, not unsigned int, and no 3rd or more args */
  183. int        creat ARGS((const char *file_spec_, mode_t mode_));
  184.  
  185. char        *cuserid ARGS((char *s_));
  186. int        delete ARGS((const char *file_spec_));
  187. FILE        *fdopen ARGS((int file_desc_, const char *a_mode_));
  188. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  189.                 /* getcwd: 2nd arg size_t instead of int */
  190. char        *getcwd ARGS((char *name_, size_t size_));
  191. char        *getlogin ARGS((void));
  192. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  193. int        isapipe ARGS((int file_desc_));
  194. int        open ARGS((const char *file_spec_, int flags_, ...));
  195. int        system ARGS((const char *command_));
  196. int        tell ARGS((int file_desc_));
  197.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  198. char        *ttyname ARGS((int file_desc_));
  199. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  200. #endif /* !__cplusplus */
  201.  
  202. #if _POSIX_SOURCE        /* compiling with c89 -D_POSIX_SOURCE */
  203. int        getw ARGS((FILE *file_ptr_));
  204. int        ioctl ARGS((int file_desc_, int request_, ...));
  205. int        putw ARGS((int integer_, FILE *file_ptr_));
  206. int        utime ARGS((const char *path_, const struct utimbuf *times_));
  207. #endif /* _POSIX_SOURCE */
  208.  
  209. #define UNIXLIB_H_DEFINED_
  210. #endif /* __hppa */
  211.  
  212. /*====================================================================*/
  213.  
  214. #if _IBMR2
  215. #include <unistd.h>
  216. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  217. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  218. #define UNIXLIB_H_DEFINED_
  219. #endif /* _IBMR2 */
  220.  
  221. /*====================================================================*/
  222.  
  223. #if __NeXT__
  224. #if !__cplusplus
  225. /* We do not use libc.h, which otherwise has most of these, because
  226. some declarations there are incorrect. */
  227. int        access ARGS((const char *file_spec_, int mode_));
  228. void        bzero ARGS((char *s_, int n_));
  229. int        close ARGS((int file_desc_));
  230. int        creat ARGS((const char *file_spec_, unsigned int mode_, ...));
  231. char        *cuserid ARGS((char *s_));
  232. int        delete ARGS((const char *file_spec_));
  233. int        dup ARGS((int file_desc_));
  234. int        dup2 ARGS((int fd_1_, int fd_2_));
  235. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  236. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  237. char        *getlogin ARGS((void));
  238. int        getw ARGS((FILE *file_ptr_));
  239. char        *getwd ARGS((char *name_));
  240. int        isapipe ARGS((int file_desc_));
  241. int        ioctl ARGS((int file_desc_, int request_, ...));
  242. int        isapipe ARGS((int file_desc_));
  243. int        isatty ARGS((int file_desc_));
  244. int        lseek ARGS((int file_desc_, int offset_, int direction_));
  245. int        open ARGS((const char *file_spec_, int flags_, ...));
  246.  
  247. int        putw ARGS((int integer_, FILE *file_ptr_));
  248. int        read ARGS((int file_desc_, void *buffer_, size_t nbytes_));
  249. unsigned int    sleep ARGS((unsigned int seconds_));
  250. int        system ARGS((const char *command_));
  251. int        tell ARGS((int file_desc_));
  252.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  253. char        *ttyname ARGS((int file_desc_));
  254. int        unlink ARGS((const char *path_));
  255. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  256. int        utime ARGS((const char *path_, time_t times_[2]));
  257. int        write ARGS((int file_desc_, const void *buffer_,
  258.             size_t nbytes_));
  259. #endif /* !__cplusplus */
  260. #define UNIXLIB_H_DEFINED_
  261. #endif /* __NeXT__ */
  262.  
  263. /*====================================================================*/
  264.  
  265. #if __sgi
  266. #include <unistd.h>
  267. #include <fcntl.h>            /* for creat() and open() */
  268.  
  269. #if __cplusplus
  270. extern "C" 
  271. {            /* missing from system include files */
  272. int        ioctl ARGS((int file_desc_, int request_, ...));    
  273. };
  274. #else /* NOT __cplusplus */
  275. void        bzero ARGS((char *s_, int n_));
  276. int        delete ARGS((const char *file_spec_));
  277. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  278.  
  279. #if __LCC__
  280. int        fileno ARGS((FILE *fp_));
  281. #endif /* __LCC__ */
  282.  
  283. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  284. int        getw ARGS((FILE *file_ptr_));
  285. int        ioctl ARGS((int file_desc_, int request_, ...));
  286. int        isapipe ARGS((int file_desc_));
  287. int        putw ARGS((int integer_, FILE *file_ptr_));
  288. int        tell ARGS((int file_desc_));
  289. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  290. #endif /* __cplusplus */
  291.  
  292. #define UNIXLIB_H_DEFINED_
  293. #endif /* __sgi */
  294.  
  295. /*====================================================================*/
  296.  
  297. #if sun && __GNUC__
  298. #include <fcntl.h>            /* for creat() and open() */
  299. #if __cplusplus
  300. extern "C"
  301. {
  302. int        access ARGS((const char *file_spec_, int mode_));
  303.         /* g++ 2.0: bzero() arg 1 is void* instead of char* */
  304. void        bzero ARGS((void *s_, int n_));
  305. int        close ARGS((int file_desc_));
  306. int        dup ARGS((int file_desc_));
  307. int        dup2 ARGS((int fd_1_, int fd_2_));
  308. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  309. int        fgetpos ARGS((FILE *file_ptr_, fpos_t *position_));
  310. int        fprintf ARGS((FILE *file_ptr_, const char *format_spec_,
  311.             ...));
  312. int        fsetpos ARGS((FILE *file_ptr_, const fpos_t *position_));
  313. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  314. int        ioctl ARGS((int file_desc_, int request_, ...));
  315. int        isapipe ARGS((int file_desc_));
  316. int        isatty ARGS((int file_desc_));
  317. int        lseek ARGS((int file_desc_, int offset_, int direction_));
  318. int        read ARGS((int file_desc_, void *buffer_, size_t nbytes_));
  319. int        remove ARGS((const char *file_spec_));
  320. int        rename ARGS((const char *old_file_spec_,
  321.             const char *new_file_spec_));
  322. unsigned int    sleep ARGS((unsigned int seconds_));
  323. int        system ARGS((const char *command_));
  324. int        tell ARGS((int file_desc_));
  325.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  326. char        *ttyname ARGS((int file_desc_));
  327. int        unlink ARGS((const char *path_));
  328. int        utime ARGS((const char *path_, time_t times_[2]));
  329. int        write ARGS((int file_desc_, const void *buffer_,
  330.             size_t nbytes_));
  331. }
  332. #else
  333. int        _filbuf ARGS((FILE *fp_));
  334. int        _flsbuf ARGS((unsigned char c_, FILE *fp_));
  335. int        access ARGS((const char *file_spec_, int mode_));
  336. void        bzero ARGS((char *s_, int n_));
  337. int        close ARGS((int file_desc_));
  338. int        delete ARGS((const char *file_spec_));
  339. int        dup ARGS((int file_desc_));
  340. int        dup2 ARGS((int fd_1_, int fd_2_));
  341. int        fclose ARGS((FILE *file_ptr_));
  342. int        fflush ARGS((FILE *file_ptr_));
  343. int        fgetc ARGS((FILE *file_ptr_));
  344. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  345. int        fgetpos ARGS((FILE *file_ptr_, fpos_t *position_));
  346. int        fprintf ARGS((FILE *file_ptr_, const char *format_spec_,
  347.             ...));
  348. int        fputc ARGS((int character_, FILE *file_ptr_));
  349. int        fputs ARGS((const char *str_, FILE *file_ptr_));
  350. size_t        fread ARGS((void *ptr_, size_t size_of_item_,
  351.             size_t number_items_, FILE *file_ptr_));
  352. int        fscanf ARGS((FILE *file_ptr_, const char *format_spec_, ...));
  353. int        fseek ARGS((FILE *file_ptr_, long offset_, int direction_));
  354. int        fsetpos ARGS((FILE *file_ptr_, const fpos_t *position_));
  355. size_t        fwrite ARGS((const void *ptr_, size_t size_of_item_,
  356.              size_t number_items_, FILE *file_ptr_));
  357. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  358. int        getw ARGS((FILE *file_ptr_));
  359. int        ioctl ARGS((int file_desc_, int request_, ...));
  360. int        isapipe ARGS((int file_desc_));
  361. int        isatty ARGS((int file_desc_));
  362. int        lseek ARGS((int file_desc_, int offset_, int direction_));
  363.  
  364. #if !HAVE_OPEN_DCL
  365. int        open ARGS((const char *file_spec_, int flags_, ...));
  366. #endif /* !HAVE_OPEN_DCL */
  367.  
  368. void        perror ARGS((const char *s_));
  369. int        printf ARGS((const char *format_spec_, ...));
  370. int        puts ARGS((const char *str_));
  371. int        putw ARGS((int integer_, FILE *file_ptr_));
  372. int        read ARGS((int file_desc_, void *buffer_, size_t nbytes_));
  373. int        remove ARGS((const char *file_spec_));
  374. int        rename ARGS((const char *old_file_spec_,
  375.             const char *new_file_spec_));
  376. void        rewind ARGS((FILE *file_ptr_));
  377. int        scanf ARGS((const char *format_spec_, ...));
  378. void        setbuf ARGS((FILE *file_ptr_, char *buffer_));
  379. int        setvbuf ARGS((FILE *file_ptr_, char *buffer_, int type_,
  380.             size_t size_));
  381. unsigned int    sleep ARGS((unsigned int seconds_));
  382. int        sscanf ARGS((const char *str_, const char *format_spec_,
  383.             ...));
  384. int        system ARGS((const char *command_));
  385. int        tell ARGS((int file_desc_));
  386.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  387. char        *ttyname ARGS((int file_desc_));
  388. int        ungetc ARGS((int character_, FILE *file_ptr_));
  389. int        unlink ARGS((const char *path_));
  390. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  391. int        utime ARGS((const char *path_, time_t times_[2]));
  392. int        vfprintf ARGS((FILE *file_ptr_, const char *format_,
  393.             void *arg_));
  394. int        vprintf ARGS((const char *format_, void *arg_));
  395. int        vsprintf ARGS((char *s_, const char *format_, void *arg_));
  396. int        write ARGS((int file_desc_, const void *buffer_,
  397.             size_t nbytes_));
  398. #endif /* __cplusplus */
  399. #define UNIXLIB_H_DEFINED_
  400. #endif /* sun && __GNUC__ */
  401.  
  402. /*====================================================================*/
  403.  
  404. #if (sun && __CC__ && !__cplusplus)
  405.                     /* native Sun compiler: cc */
  406. #include <unistd.h>
  407. void        bzero ARGS((char *s_, int n_));
  408. int        creat ARGS((const char *file_spec_, unsigned int mode_, ...));
  409. int        delete ARGS((const char *file_spec_));
  410. FILE        *fdopen ARGS((int file_desc_, const char *a_mode_));
  411. int        _filbuf ARGS((FILE *fp_));
  412. int        _flsbuf ARGS((unsigned char c_, FILE *fp_));
  413. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  414. int        fgetpos ARGS((FILE *file_ptr_, fpos_t *position_));
  415. int        fsetpos ARGS((FILE *file_ptr_, const fpos_t *position_));
  416. char        *getlogin ARGS((void));
  417. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  418. int        getw ARGS((FILE *file_ptr_));
  419. int        ioctl ARGS((int file_desc_, int request_, ...));
  420. int        isapipe ARGS((int file_desc_));
  421. int        open ARGS((const char *file_spec_, int flags_, ...));
  422. int        putw ARGS((int integer_, FILE *file_ptr_));
  423. int        setvbuf ARGS((FILE *file_ptr_, char *buffer_, int type_,
  424.             size_t size_));
  425. int        system ARGS((const char *command_));
  426. int        tell ARGS((int file_desc_));
  427.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  428. char        *tmpnam ARGS((char *name_));
  429. int        unlink ARGS((const char *path_));
  430. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  431. int        utime ARGS((const char *path_, time_t times_[2]));
  432. int        vfprintf ARGS((FILE *file_ptr_, const char *format_,
  433.             void *arg_));
  434. int        vprintf ARGS((const char *format_, void *arg_));
  435. int        vsprintf ARGS((char *s_, const char *format_, void *arg_));
  436.  
  437. #define UNIXLIB_H_DEFINED_
  438. #endif /* (sun && __CC__ && !__cplusplus) */
  439.  
  440. /*====================================================================*/
  441.  
  442. #if (sun && __ACC__ && !__cplusplus)
  443.                     /* native ISO/ANSI Sun compiler: acc */
  444. #include <unistd.h>
  445. void        bzero ARGS((char *s_, int n_));
  446. int        creat ARGS((const char *file_spec_, unsigned int mode_, ...));
  447. int        delete ARGS((const char *file_spec_));
  448. FILE        *fdopen ARGS((int file_desc_, const char *a_mode_));
  449. int        _filbuf ARGS((FILE *fp_));
  450. int        _flsbuf ARGS((unsigned char c_, FILE *fp_));
  451. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  452. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  453. int        getw ARGS((FILE *file_ptr_));
  454. int        ioctl ARGS((int file_desc_, int request_, ...));
  455. int        isapipe ARGS((int file_desc_));
  456. int        open ARGS((const char *file_spec_, int flags_, ...));
  457. int        putw ARGS((int integer_, FILE *file_ptr_));
  458. int        system ARGS((const char *command_));
  459. int        tell ARGS((int file_desc_));
  460.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  461. char        *tmpnam ARGS((char *name_));
  462. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  463. int        utime ARGS((const char *path_, time_t times_[2]));
  464.  
  465. #define UNIXLIB_H_DEFINED_
  466. #endif /* (sun && __ACC__ && !__cplusplus) */
  467.  
  468. /*====================================================================*/
  469.  
  470. #if __TURBOC__
  471. #include <io.h>                /* for low-level I/O declarations */
  472. #if !__cplusplus
  473. void        bzero ARGS((char *s_, int n_));
  474. char        *cuserid ARGS((char *s_));
  475.         /* this function conflicts with C++ reserved word */
  476. int        delete ARGS((const char *file_spec_));
  477.  
  478. #if (__TURBOC__ < 0x0400)
  479. FILE        *fdopen ARGS((int file_desc_, const char *a_mode_));
  480. #endif /* (__TURBOC__ < 0x0400) */
  481.  
  482. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  483. char        *getcwd ARGS((char *name_, int size_));
  484. char        *getlogin ARGS((void));
  485. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  486. int        getw ARGS((FILE *file_ptr_));
  487. int        isapipe ARGS((int file_desc_));
  488. int        putw ARGS((int integer_, FILE *file_ptr_));
  489.  
  490. #if (__TURBOC__ < 0x0400)
  491. unsigned int    sleep ARGS((unsigned int seconds_));
  492. #endif /* (__TURBOC__ < 0x0400) */
  493.  
  494. int        system ARGS((const char *command_));
  495. char        *ttyname ARGS((int file_desc_));
  496. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  497. int        utime ARGS((const char *path_, time_t times_[2]));
  498. #endif /* !__cplusplus */
  499. #define UNIXLIB_H_DEFINED_
  500. #endif /* __TURBOC__ */
  501.  
  502. /*====================================================================*/
  503.  
  504. #if ultrix
  505. #include <sys/stat.h>            /* need for struct stat definition */
  506.  
  507. #if __cplusplus
  508. #include <unistd.h>
  509. #else /* NOT __cplusplus */
  510. int        access ARGS((const char *file_spec_, int mode_));
  511. void        bzero ARGS((char *s_, int n_));
  512. int        close ARGS((int file_desc_));
  513. int        creat ARGS((const char *file_spec_, unsigned int mode_));
  514. char        *cuserid ARGS((char *s_));
  515. int        delete ARGS((const char *file_spec_));
  516. int        dup ARGS((int file_desc_));
  517. int        dup2 ARGS((int fd_1_, int fd_2_));
  518. FILE        *fdopen ARGS((int fildes_, char *type_));
  519.  
  520. #if __LCC__
  521. int        fileno ARGS((FILE *fp_));
  522. #endif /* __LCC__ */
  523.  
  524. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  525.  
  526. #if __GNUC__
  527. int        fprintf ARGS((FILE *file_ptr_, const char *format_spec_,
  528.             ...));
  529. #endif /* __GNUC__ */
  530.  
  531. int        fstat ARGS((int file_desc_, struct stat *buffer_));
  532. char        *getcwd ARGS((char *name_, int size_));
  533. char        *getlogin ARGS((void));
  534. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  535. int        getw ARGS((FILE *file_ptr_));
  536. int        ioctl ARGS((int file_desc_, int request_, ...));
  537. int        isapipe ARGS((int file_desc_));
  538. int        isatty ARGS((int file_desc_));
  539. int        lseek ARGS((int file_desc_, int offset_, int direction_));
  540. int        open ARGS((const char *file_spec_, int flags_, int mode_));
  541. int        putw ARGS((int integer_, FILE *file_ptr_));
  542. int        read ARGS((int file_desc_, void *buffer_, size_t nbytes_));
  543. unsigned int    sleep ARGS((unsigned int seconds_));
  544. int        system ARGS((const char *command_));
  545. int        tell ARGS((int file_desc_));
  546.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  547. char        *ttyname ARGS((int file_desc_));
  548. int        unlink ARGS((const char *path_));
  549. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  550. int        utime ARGS((const char *path_, time_t times_[2]));
  551. int        write ARGS((int file_desc_, const void *buffer_,
  552.             size_t nbytes_));
  553. #endif /* __cplusplus */
  554.  
  555. #if (__GNUC__ && __cplusplus)
  556. extern "C"
  557. {
  558. int        fprintf ARGS((FILE *file_ptr_, const char *format_spec_,
  559.             ...));
  560. int        utime ARGS((const char *path_, time_t times_[2]));
  561. }
  562. #endif /* (__GNUC__ && __cplusplus) */
  563.  
  564. #define UNIXLIB_H_DEFINED_
  565. #endif /* ultrix */
  566.  
  567. /*====================================================================*/
  568.  
  569. #if    OS_PCDOS
  570.  
  571. #if !__cplusplus
  572. char        *cuserid ARGS((char *s_));
  573. int        utime ARGS((const char *path_, time_t times_[2]));
  574. #endif /* !__cplusplus */
  575.  
  576. #define UNIXLIB_H_DEFINED_
  577. #endif /* OS_PCDOS */
  578.  
  579.  
  580. /*====================================================================*/
  581.  
  582. #if    OS_VAXVMS
  583.  
  584. #if !__cplusplus
  585. #include <unixlib.h>
  586. #include <unixio.h>
  587. void        bzero ARGS((char *s_, int n_));
  588. char        *cuserid ARGS((char *s_));
  589. char        *getlogin ARGS((void));
  590. int        ioctl ARGS((int file_desc_, int request_, ...));
  591. unsigned int    sleep ARGS((unsigned int seconds_));
  592. int        system ARGS((const char *command_));
  593. int        tell ARGS((int file_desc_));
  594.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  595. char        *ttyname ARGS((void));    /* should be int file_desc_ */
  596.                     /* but VMS lacks it */
  597. int        unlink ARGS((const char *path_));
  598. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  599. int        utime ARGS((const char *path_, time_t times_[2]));
  600. #endif /* !__cplusplus */
  601.  
  602. #define UNIXLIB_H_DEFINED_
  603. #endif /* OS_VAXVMS */
  604.  
  605. /*====================================================================*/
  606.  
  607. #if __cplusplus
  608. extern "C" {
  609. #endif /* __cplusplus */
  610.  
  611. #if HAVE_GETHOSTNAME
  612. #if !HAVE_GETHOSTNAME_DCL
  613. int        gethostname ARGS((char *name_, int namelen_));
  614. #endif /* !HAVE_GETHOSTNAME_DCL */
  615. #else /* NOT HAVE_GETHOSTNAME */
  616. #define    gethostname(name_,namelen_)    ((name_), (namelen_), EOF)
  617. #endif /* !HAVE_GETHOSTNAME */
  618.  
  619. #if HAVE_GETLOGIN
  620. #if !HAVE_GETLOGIN_DCL
  621. char        *getlogin ARGS((void));
  622. #endif /* !HAVE_GETLOGIN_DCL */
  623. #else /* NOT HAVE_GETLOGIN */
  624. #define getlogin()    ((char*)NULL)
  625. #endif /* HAVE_GETLOGIN */
  626.  
  627. #if HAVE_GETCWD && !HAVE_GETCWD_DCL
  628. char        *getcwd ARGS((char *name_, int size_));
  629. #endif /* HAVE_GETCWD && !HAVE_GETCWD_DCL */
  630.  
  631. #if HAVE_GETWD && !HAVE_GETWD_DCL
  632. char        *getwd ARGS((char *name_));
  633. #endif /* HAVE_GETWD && !HAVE_GETWD_DCL */
  634.  
  635. #if !HAVE_GETWD
  636. /* Posix defines getcwd() but not getwd(), while older UNIX systems
  637. have only getwd().  For other systems, we define getwd() in terms of
  638. getcwd(). */
  639. #define getwd(name_) (char*)getcwd((char*)(name_),(int)sizeof(name_))
  640. #endif /* !HAVE_GETWD */
  641.  
  642. #if (HAVE_GETWD && !HAVE_GETCWD)
  643. #define getcwd(name_,size_)    (char*)getwd((char*)name_)
  644. #endif /* (HAVE_GETWD && !HAVE_GETCWD) */
  645.  
  646. #if    (!HAVE_GETCWD && !HAVE_GETWD)
  647. #define getcwd(name_,size_)        ((name_), (size_), (char*)NULL)
  648. #endif /* (!HAVE_GETCWD && !HAVE_GETWD) */
  649.  
  650. #if __cplusplus
  651. }
  652. #endif /* __cplusplus */
  653.  
  654. /*====================================================================*/
  655.  
  656. #ifndef UNIXLIB_H_DEFINED_
  657. #define UNIXLIB_H_DEFINED_
  658.  
  659. #if    OS_UNIX
  660. #if __cplusplus
  661. extern "C"
  662. {
  663. #include <osfcn.h>            /* needed for access() */
  664. }
  665. #else /* NOT __cplusplus */
  666. #include "xstat.h"
  667.  
  668. /* Low-level I/O functions */
  669.  
  670. int        access ARGS((const char *file_spec_, int mode_));
  671. int        close ARGS((int file_desc_));
  672. int        creat ARGS((const char *file_spec_, unsigned int mode_, ...));
  673. char        *cuserid ARGS((char *s_));
  674. int        delete ARGS((const char *file_spec_));
  675. int        dup ARGS((int file_desc_));
  676. int        dup2 ARGS((int fd_1_, int fd_2_));
  677.  
  678. #if sun || (hp300 && __GNUC__) || (mips && __GNUC__)
  679.                 /* <stdio.h> uses these without prototypes */
  680. int        _filbuf ARGS((FILE *fp_));
  681. int        _flsbuf ARGS((unsigned char c_, FILE *fp_));
  682. #endif /* sun || (hp300 && __GNUC__)  || (mips && __GNUC__) */
  683.  
  684. int        fstat ARGS((int file_desc_, struct stat *buffer_));
  685. char        *getname ARGS((int file_desc_, char *buffer_, ...));
  686. int        ioctl ARGS((int file_desc_, int request_, ...));
  687. int        isapipe ARGS((int file_desc_));
  688. int        isatty ARGS((int file_desc_));
  689. int        lseek ARGS((int file_desc_, int offset_, int direction_));
  690.  
  691. #if !HAVE_OPEN_DCL
  692. int        open ARGS((const char *file_spec_, int flags_, ...));
  693. #endif /* !HAVE_OPEN_DCL */
  694.  
  695. int        read ARGS((int file_desc_, void *buffer_, size_t nbytes_));
  696. int        remove ARGS((const char *file_spec_));
  697. int        rename ARGS((const char *old_file_spec_,
  698.             const char *new_file_spec_));
  699. int        stat ARGS((const char *file_spec_, struct stat *buffer_));
  700. char        *ttyname ARGS((int file_desc_));
  701. int        write ARGS((int file_desc_, const void *buffer_,
  702.             size_t nbytes_));
  703.  
  704. /* High-level I/O functions.  It appears that library functions of type
  705. int usually are not given prototypes in UNIX stdio.h. */
  706.  
  707. int        fclose ARGS((FILE *file_ptr_));
  708. FILE        *fdopen ARGS((int file_desc_, const char *a_mode_));
  709. int        fflush ARGS((FILE *file_ptr_));
  710. int        fgetc ARGS((FILE *file_ptr_));
  711. char        *fgetname ARGS((FILE *file_ptr_, char *buffer_, ...));
  712. int        fgetpos ARGS((FILE *file_ptr_, fpos_t *position_));
  713. char        *fgets ARGS((char *str_, int maxchar_, FILE *file_ptr_));
  714.  
  715. #if !__GNUC__    /* complains of conflict with stdio.h definition */
  716. #if !ardent
  717. FILE        *fopen ARGS((const char *filespec_, const char *a_mode_,
  718.             ...));
  719. #endif /* !ardent */
  720. #endif /* !__GNUC__ */
  721.  
  722. int        fprintf ARGS((FILE *file_ptr_, const char *format_spec_,
  723.             ...));
  724. int        fputc ARGS((int character_, FILE *file_ptr_));
  725. int        fputs ARGS((const char *str_, FILE *file_ptr_));
  726.  
  727. #if    KCC_20
  728. int        fread ARGS((void *ptr_, size_t size_of_item_,
  729.             size_t number_items_, FILE *file_ptr_));
  730. #else /* NOT KCC_20 */
  731. #if !ardent
  732. size_t        fread ARGS((void *ptr_, size_t size_of_item_,
  733.             size_t number_items_, FILE *file_ptr_));
  734. #endif /* !ardent */
  735. #endif /* KCC_20 */
  736.  
  737. #if !__GNUC__    /* complains of conflict with stdio.h definition */
  738. #if !ardent
  739. FILE        *freopen ARGS((const char *file_spec_, const char *a_mode_,
  740.             FILE *file_ptr_, ...));
  741. #endif /* !ardent */
  742. #endif /* !__GNUC__ */
  743.  
  744. int        fscanf ARGS((FILE *file_ptr_, const char *format_spec_, ...));
  745. int        fseek ARGS((FILE *file_ptr_, long offset_, int direction_));
  746. int        fsetpos ARGS((FILE *file_ptr_, const fpos_t *position_));
  747. long        ftell ARGS((FILE *file_ptr_));
  748.  
  749. #if    KCC_20
  750. int        fwrite ARGS((const void *ptr_, size_t size_of_item_,
  751.              size_t number_items_, FILE *file_ptr_));
  752. #else /* NOT KCC_20 */
  753. #if !ardent
  754. size_t        fwrite ARGS((const void *ptr_, size_t size_of_item_,
  755.              size_t number_items_, FILE *file_ptr_));
  756. #endif /* !ardent */
  757. #endif /* KCC_20 */
  758.  
  759. char        *gets ARGS((char *str_));
  760. int        getw ARGS((FILE *file_ptr_));
  761. int        printf ARGS((const char *format_spec_, ...));
  762. int        puts ARGS((const char *str_));
  763. int        putw ARGS((int integer_, FILE *file_ptr_));
  764.  
  765. #if    OS_VAXVMS
  766. int        rewind ARGS((FILE *file_ptr_));
  767.                     /* library declaration wrong, sigh.. */
  768. #else  /* NOT OS_VAXVMS */
  769. void        rewind ARGS((FILE *file_ptr_));
  770. #endif /* OS_VAXVMS */
  771.  
  772. int        scanf ARGS((const char *format_spec_, ...));
  773.  
  774. #if !ardent
  775. void        setbuf ARGS((FILE *file_ptr_, char *buffer_));
  776. int        setvbuf ARGS((FILE *file_ptr_, char *buffer_, int type_,
  777.             size_t size_));
  778. #endif /* ardent */
  779.  
  780. #if ultrix
  781. char        *sprintf ARGS((char *str_, const char *format_spec_, ...));
  782. #else /* NOT ultrix */
  783. #if apollo
  784. char        *sprintf ARGS((char *str_, char *format_spec_, ...));
  785. #else /* NOT apollo */
  786. #if sun
  787. char        *sprintf ARGS((char *str_, const char *format_spec_, ...));
  788. #else /* NOT sun */
  789. int        sprintf ARGS((char *str_, const char *format_spec_, ...));
  790. #endif /* sun */
  791. #endif /* apollo */
  792. #endif /* ultrix */
  793.  
  794. int        sscanf ARGS((const char *str_, const char *format_spec_,
  795.             ...));
  796. FILE        *tmpfile ARGS((void));
  797. char        *tmpnam ARGS((char *name_));
  798. int        ungetc ARGS((int character_, FILE *file_ptr_));
  799.  
  800. #if !ardent
  801. int        vfprintf ARGS((FILE *file_ptr_, const char *format_,
  802.             void *arg_));
  803. int        vprintf ARGS((const char *format_, void *arg_));
  804. int        vsprintf ARGS((char *s_, const char *format_, void *arg_));
  805. #endif /* !ardent */
  806.  
  807. /* miscellaneous library functions */
  808.  
  809. void        bzero ARGS((char *s_, int n_));
  810. void        perror ARGS((const char *s_));
  811. unsigned int    sleep ARGS((unsigned int seconds_));
  812. int        system ARGS((const char *command_));
  813. int        tell ARGS((int file_desc_));
  814.                 /* obsolete; use lseek(file_desc_, 0L, 1) */
  815. time_t        time ARGS((time_t *time_location_));
  816. int        unlink ARGS((const char *path_));
  817. unsigned int    usleep ARGS((unsigned int microseconds_)); /* in Sun OS */
  818. int        utime ARGS((const char *path_, time_t times_[2]));
  819. #endif /* __cplusplus */
  820. #endif /* OS_UNIX */
  821. #endif /* UNIXLIB_H_DEFINED_ */
  822. #endif /* UNIXLIB_H_DEFINED_ */
  823.